package com.project.server.service.impl;

import com.project.server.common.Result;
import com.project.server.mapper.*;
import com.project.server.model.Dish;
import com.project.server.service.DashboardService;
import com.project.server.vo.DashboardStatsVO;
import com.project.server.vo.RevenueVO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.util.List;

@Service
@RequiredArgsConstructor
public class DashboardServiceImpl implements DashboardService {

    private final DashboardMapper dashboardMapper;

    @Override
    public Result<DashboardStatsVO> getStats() {
        DashboardStatsVO stats = new DashboardStatsVO();

        // 订单相关统计
        stats.setTodayOrders(dashboardMapper.getTodayOrderCount());
        stats.setPendingOrders(dashboardMapper.getPendingOrderCount());

        // 菜品相关统计
        stats.setTotalDishes(dashboardMapper.getTotalDishCount());
        stats.setActiveDishes(dashboardMapper.getActiveDishCount());
        stats.setInactiveDishes(dashboardMapper.getInactiveDishCount());
        stats.setHotDishCount(dashboardMapper.getHotDishCount());

        return Result.success(stats);
    }


    @Override
    public List<Dish> getHotDishes(Long limit) {
        return dashboardMapper.getHotDishes(limit);
    }



}
